package com.loongson;

import com.google.gson.Gson;

public class VmInfo {
	private String serverId;
	private String vncUrl;
	private String name;
	private String floatIp;
	public VmInfo(String serverId, String vncUrl, String name, String floatIp) {
		super();
		this.serverId = serverId;
		this.vncUrl = vncUrl;
		this.name = name;
		this.floatIp = floatIp;
	}

	public String getServerId() {
		return serverId;
	}
	public void setServerId(String serverId) {
		this.serverId = serverId;
	}
	public String getVncUrl() {
		return vncUrl;
	}
	public void setVncUrl(String vncUrl) {
		this.vncUrl = vncUrl;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getFloatIp() {
		return floatIp;
	}
	public void setFloatIp(String floatIp) {
		this.floatIp = floatIp;
	}
	
	 public String toString(){
		String str = String.format("serverId:%s,serverName:%s,vncUrl:%s,floadIp:%s",serverId,name,vncUrl,floatIp);	 
		return str;
	 }
	 public String toJsonString(){
		 Gson gson = new Gson();  
		 return gson.toJson(this);
		
	 }

	 
	 public static void main(String[] args){
    	 VmInfo vm = new VmInfo("1","2","3","4");
    	 Gson gson = new Gson();  
		 gson.toJson(vm);
		 String jsonStr= gson.toJson(vm);
		 VmInfo vm2 = UtilTool.GetVmInfoFromJson(jsonStr);
		 
		 System.out.println(gson.toJson(vm));
		 System.out.print(vm2);
    	 
    	 
     }
}
